package com.cskaoyan.service;

import com.cskaoyan.bean.MarketOrderGoods;
import com.cskaoyan.mapper.MarketOrderGoodsMapper;
import com.cskaoyan.util.MyBatisUtil;
import com.cskaoyan.util.TransactionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author Ramsey
 * @date 2023年05月29日 19:21
 */
public class OrderGoodsServiceimpl implements OrderGoodsService {

    @Override
    public List<MarketOrderGoods> OrderGoodsSelectByOrderId(Integer orderId) {
        SqlSession sqlSession = MyBatisUtil.getSqlSession();
        MarketOrderGoodsMapper mapper = sqlSession.getMapper(MarketOrderGoodsMapper.class);
        List<MarketOrderGoods> marketOrderGoods = mapper.OrderGoodsSelectByOrderId(orderId);
        return marketOrderGoods;
    }

    @Override
    public void OrderGoodsSelectByDelete(Integer orderId) {
        SqlSession sqlSession = TransactionUtil.getSqlSession();
        MarketOrderGoodsMapper mapper = sqlSession.getMapper(MarketOrderGoodsMapper.class);
        mapper.updateByDelete(orderId);
    }
}
